﻿<%@ Page Title="Driver Preference Selection" Language="VB" MasterPageFile="MasterPage.master"
    AutoEventWireup="false" CodeFile="preferences.aspx.vb" Inherits="service_driver_preferences" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div class="preferences-information-area">
        <asp:Label ID="errorLabel" runat="server" Text="" CssClass="error-label" Visible="False"></asp:Label>
    </div>
    <h1>Preference Instructions</h1>
    <ol>
        <li>Please pick all the semester events which you would like to drive.</li>
        <li>Click on a day to find the projects available that day.</li>
        <li>Check all events you would like to drive by day.</li>
        <li>Click the Save Selected Preferences button before going to a different day.</li>
        <li>The lists are sortable by clicking on column titles in the table.</li>
        <li style="color:Red;">You must account for the travel time along with the event time for an accurate start and end time for each event.</li>
        <li>One-time projects are not included in this list.</li>
    </ol>
    <div class="preferences-current box-container">
        <h2>
            Current Preferences</h2>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:serviceConnectionString %>"
            DeleteCommand="DELETE FROM [driver_preferences] WHERE [id] = @id">
            <DeleteParameters>
                <asp:Parameter Name="id" Type="Int32" />
            </DeleteParameters>
        </asp:SqlDataSource>
        <asp:GridView ID="GridView2" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="False"
            AutoGenerateDeleteButton="False" EnableModelValidation="True" DataKeyNames="id"
            CssClass="awesome-gridview" AllowSorting="True">
            <Columns>
                <asp:BoundField DataField="activityid" HeaderText="Activity ID" SortExpression="activityid" />
                       <asp:HyperLinkField Target=_blank DataNavigateUrlFields="activityid" DataNavigateUrlFormatString="http://www.jcu.edu/service2/activity_detail.asp?id={0}" DataTextField="activity-name" HeaderText="Activity Name" SortExpression="activity-name"/>                       
                        <asp:BoundField DataField="begin_date" HeaderText="Starting Date" DataFormatString="{0:MMMM dd, yyyy}"
                            SortExpression="begin_date" />
                        <asp:BoundField DataField="end_date" HeaderText="Ending Date" DataFormatString="{0:MMMM dd, yyyy}"
                            SortExpression="end_date" />               
                        <asp:TemplateField HeaderText="Start with travel" SortExpression="begin_time">
                            <ItemTemplate>
                               <asp:Label ID="begin_time_wtrav" Text='<%# string.Format("{0:hh:mm tt}",Eval("begin_time").AddMinutes(-(Eval("travel_time")))) %>'  runat="server" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="End with travel" SortExpression="end_time">
                            <ItemTemplate>
                               <asp:Label ID="end_time_wtrav" Text='<%# string.Format("{0:hh:mm tt}",Eval("end_time").AddMinutes((Eval("travel_time"))))  %>'  runat="server" />
                            </ItemTemplate>
                        </asp:TemplateField>	
                <asp:CommandField ShowDeleteButton="true" ButtonType="Image" DeleteImageUrl="images/delete.png"
                    ControlStyle-CssClass="delete-button" HeaderText="Remove" />
            </Columns>
        </asp:GridView>
    </div>

    <div class="clearer"></div>

    

    
    <div class="clearer"></div>
    <h2>
        Add New Preferences</h2>
    <table>
        <tr>
            <td colspan="8">
                <center>
                    <asp:Button ID="SaveButton" runat="server" Text="Save Selected Preferences" CssClass="awesome-button" /></center>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Button ID="AllButton" runat="server" Text="All" CssClass="awesome-button" />
            </td>
            <td>
                <asp:Button ID="SundayButton" runat="server" Text="Sunday" CssClass="awesome-button" />
            </td>
            <td>
                <asp:Button ID="MondayButton" runat="server" Text="Monday" CssClass="awesome-button" />
            </td>
            <td>
                <asp:Button ID="TuesdayButton" runat="server" Text="Tuesday" CssClass="awesome-button" />
            </td>
            <td>
                <asp:Button ID="WednesdayButton" runat="server" Text="Wednesday" CssClass="awesome-button" />
            </td>
            <td>
                <asp:Button ID="ThursdayButton" runat="server" Text="Thursday" CssClass="awesome-button" />
            </td>
            <td>
                <asp:Button ID="FridayButton" runat="server" Text="Friday" CssClass="awesome-button" />
            </td>
            <td>
                <asp:Button ID="SaturdayButton" runat="server" Text="Saturday" CssClass="awesome-button" />
            </td>
        </tr>
        <tr>
            <td colspan="8">
                <asp:SqlDataSource ID="CSSADB_Preferences" runat="server" ConnectionString="<%$ ConnectionStrings:serviceConnectionString %>">
                </asp:SqlDataSource>
                <asp:GridView CssClass="awesome-gridview" ID="GridView1" runat="server" DataSourceID="CSSADB_Preferences"
                    AutoGenerateColumns="False" EnableModelValidation="True" AllowSorting="True"
                    EnableSortingAndPagingCallbacks="False" CellPadding="2">
                    <Columns>
					
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:CheckBox ID="prefCheck" runat="server" />
                            </ItemTemplate>
                        </asp:TemplateField>
					   <asp:BoundField DataField="activityid" HeaderText="Activity ID" SortExpression="activityid" />
                       <asp:HyperLinkField Target=_blank DataNavigateUrlFields="activityid" DataNavigateUrlFormatString="http://www.jcu.edu/service2/activity_detail.asp?id={0}" DataTextField="activity-name" HeaderText="Activity Name" SortExpression="activity-name"/>                       
                        <asp:BoundField DataField="begin_date" HeaderText="Starting Date" DataFormatString="{0:MMMM dd, yyyy}"
                            SortExpression="begin_date" />
                        <asp:BoundField DataField="end_date" HeaderText="Ending Date" DataFormatString="{0:MMMM dd, yyyy}"
                            SortExpression="end_date" />               
                        <asp:TemplateField HeaderText="Start with travel" SortExpression="begin_time">
                            <ItemTemplate>
                               <asp:Label ID="begin_time_wtrav" Text='<%# string.Format("{0:hh:mm tt}",Eval("begin_time").AddMinutes(-(Eval("travel_time")))) %>'  runat="server" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="End with travel" SortExpression="end_time">
                            <ItemTemplate>
                               <asp:Label ID="end_time_wtrav" Text='<%# string.Format("{0:hh:mm tt}",Eval("end_time").AddMinutes((Eval("travel_time"))))  %>'  runat="server" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        

                    </Columns>
                </asp:GridView>
            </td>
        </tr>
    </table>
</asp:Content>
